﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler
{
    public class RoleUpdateCommandHandler : IRequestHandler<RoleUpdateCommand, int>
    {
        private readonly IRoleService roleService;

        public RoleUpdateCommandHandler(IRoleService roleService)
        {
            this.roleService = roleService;
        }

        public async Task<int> Handle(RoleUpdateCommand request, CancellationToken cancellationToken)
        {
            return await roleService.RoleUpd(new RoleInfo() { RName = request.RName, RoleInfoid = request.RoleInfoid, AddName = request.AddName, AddTime = request.AddTime, Isdel = request.Isdel });
        }
    }
}
